fix: Windows compatibility and correct hook configuration syntax#11
Merged
itz4blitz merged 2 commits intoitz4blitz:mainfrom Feb 17, 2026
Merged
Conversation
- session-start.js: Add cross-platform CLI detection (Windows/macOS/Linux) - Check AGENTFUL_PARALLEL env var first - Try multiple npm global paths for Windows and Unix - Default to enabled if CLI not found (newer versions have it by default) - architect-drift-detector.js: Fix exit code handling - Always exit 0 (drift is informational, not an error) - Non-zero exit codes are interpreted as hook errors by Claude Code - settings.json template: Use correct matcher syntax - Replace "tools": ["Write", "Edit"] with "matcher": "Write|Edit|NotebookEdit" - The tools array syntax causes errors for non-listed tools (Glob, Read, etc.) - matcher uses regex patterns per Claude Code documentation Fixes hook errors on Windows and ensures consistent behavior across platforms.
- Wrap `npm root -g` in its own try/catch so it doesn't blow up array construction on Windows when npm isn't in PATH - Remove overly broad `Task\(` regex that matches any JS file - Restore `enabled: false` for gate-exists and error paths so the detection function actually distinguishes enabled vs disabled
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes hook errors on Windows and ensures consistent cross-platform behavior.
Changes
1.
bin/hooks/session-start.js- Cross-platform CLI detectionProblem: The original code only checked one npm global path, which doesn't work on Windows.
Solution:
AGENTFUL_PARALLELenv var first (user override)enabled: trueif CLI not found (newer Claude Code versions have parallel execution by default)2.
bin/hooks/architect-drift-detector.js- Exit code handlingProblem: The hook exited with code 1 when drift was detected, which Claude Code interprets as a hook error.
Solution: Always exit with code 0. Drift detection is informational, not an error.
3.
template/.claude/settings.json- Correct matcher syntaxProblem: PreToolUse hooks used
"tools": ["Write", "Edit"]which is incorrect syntax and causes errors for tools not in the list (Glob, Read, etc.).Solution: Use the documented
matchersyntax with regex patterns:Testing
All hooks tested on Windows 11:
No more PostToolUse:Glob or PostToolUse:Read errors.
Related Issues
Fixes hook errors reported by Windows users when using Glob/Read tools.